import {Router, Route,Switch,Redirect} from 'react-router-dom'
import React,{Suspense} from 'react'
// import Home from "pages/Layout"
// import Login from "pages/Login"
import AuthRoute from 'components/AuthRoute'
import history from 'utils/history'
const Login = React.lazy(()=>import('pages/Login'))
const Layout = React.lazy(()=>import('pages/Layout'))
function App() {
  return (
    <Router history={history}>
    <div className="App">
      <Suspense fallback={<div>loading...</div>}>
      <Switch>
        <Redirect exact from="/" to="/home"></Redirect>
        <AuthRoute path='/home' component={Layout}></AuthRoute>
        <Route path='/login' component={Login}></Route>
      </Switch>
      </Suspense>
    </div>
    </Router>
  );
}

export default App;
